import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FollowingVO, FollowingForm, FollowingQuery } from '@/api/system/following/types';

/**
 * 查询我的关注列表
 * @param query
 * @returns {*}
 */

export const listFollowing = (query?: FollowingQuery): AxiosPromise<FollowingVO[]> => {
  return request({
    url: '/system/following/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询我的关注详细
 * @param id
 */
export const getFollowing = (id: string | number): AxiosPromise<FollowingVO> => {
  return request({
    url: '/system/following/' + id,
    method: 'get'
  });
};

/**
 * 新增我的关注
 * @param data
 */
export const addFollowing = (data: FollowingForm) => {
  return request({
    url: '/system/following',
    method: 'post',
    data: data
  });
};

/**
 * 修改我的关注
 * @param data
 */
export const updateFollowing = (data: FollowingForm) => {
  return request({
    url: '/system/following',
    method: 'put',
    data: data
  });
};

/**
 * 删除我的关注
 * @param id
 */
export const delFollowing = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/following/' + id,
    method: 'delete'
  });
};
